function myNew(fn) {
    const obj = Object.create(fn.prototype)
    const result = fn.apply(obj, [...arguments].slice(1))
    return typeof(result) === 'object' ? result : obj
}

function User(name, age) {
    this.name = name
    this.age = age
}

const obj = myNew(User, 'kaho', 28)
console.log(obj)